/** \file CircArray_t.cc 
 * Test definitions for the class CircArray.
 *
 * (C) Copyright by Semih Cemiloglu
 * All rights reserved, see COPYRIGHT file for details.
 *
 * $Id: CircArray_t.cc 110 2006-06-19 03:38:33Z semihc $
 *
 *
 */


#include "CircArray.hpp"
#include "TestHarness.hh"

#undef max
#undef min

using namespace std;
using namespace TC;


TEST(CircArrayTest, Base)
{
  //TC_LOG_FUNC(CircArray_test);
    CircArray<float> carr(5);
    unsigned i;

    TC_TEST(carr.empty());

    for(i=0; i<9; ++i) {
      carr.push(i);
      if(i==3) {
	TC_TEST(carr.size()==4);
	TC_TEST(3==carr.at(3));
      }
    }

    

    double max = carr.max();
    double min = carr.min();
    double avg = carr.avg();

    TC_LOG_DEBUG("max=" << max);
    TC_LOG_DEBUG("min=" << min);
    TC_LOG_DEBUG("avg=" << avg);
    
    TC_TEST(8==max);
    TC_TEST(4==min);
    TC_TEST(6==avg);

    TC_TEST(4==carr.at(0));
    TC_TEST(8==carr.at(4));
    TC_TEST(carr.size()==5);

}

  



